
interface IProduct {
  show: () => void
}

class Car implements IProduct {
  show() {
    console.log('Car');
  };
}

class Motor implements IProduct {
  show() {
    console.log('Motor');
  }
}
enum EnumProduct {
  car = 'car',
  motor = 'motor'

}
class SimpleFactory {
  makeProduct(type: EnumProduct) {
    if (type === EnumProduct.car) {
      return new Car()
    }
    if (type === EnumProduct.motor) {
      return new Motor()
    }
  }
}


const simpleFactory = new SimpleFactory()
const car = simpleFactory.makeProduct(EnumProduct.car)
car.show()
const motor = simpleFactory.makeProduct(EnumProduct.motor)
motor.show()